import request from "@/utils/request"
export default {
    getList() {
        return request({
            url: "teacher/list",
            method: 'get'
        })
    },
    //分页查询
    // page当前页码, size 每页显示条数, searchMap 条件
    // 后台要通过 page 和 size 统计本次请求响应的数据
    search(page, size, searchMap) {
        console.log('searchMap', searchMap);
        return request({
            url: 'teacher/list',
            method: 'post',
            data: {
                page,
                size,
                searchMap
            }
        })
    },
    //新增教师
    add(teacher) {
        return request({
            url: '/teacher',
            method: 'post',
            data: teacher
        })
    },
    //根据id查询教师
    getById(id) {
        return request({
            url: `/teacher?id=${id}`,
            method: "get"
        })
    },
    //修改教师信息
    update(teacher) {
        return request({
            url: '/teacher',
            method: "put",
            data: teacher
        })
    },
    //删除教师
    deleteById(id) {
        return request({
            url: `/teacher`,
            method: 'delete',
            data: {
                id: id
            }
        })
    }
}
